package com.jy.rhin.support.polymorphism.convertor;

import com.jy.rhin.infra.exception.RhinAggrErrorType;
import com.jy.rhin.support.util.Asserts;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author dhl
 * @date 2022/6/22
 * @Description
 */
@Component
public class DocumentQueryHandlerFactory {
    /**
     * 启动自行加载实现类列表（11个查询实例）
     */
    @Resource
    Map<String, AbstractDocumentQueryHandler<?,?>> map;

    public DocumentQueryHandler getIns(String queryName){
        Asserts.isTrue(map.containsKey(queryName), RhinAggrErrorType.METHOD_NAME_ERROR);
        return map.get(queryName);
    }

}
